#encoding: utf-8
module Cpanel::IntroducesHelper

  def flag_language_nav_for(flag, language)

    html = ""

    if language == '1'
      html.concat(content_tag(:li, content_tag(:a, '简体中文', href: "/cpanel/introduces/show/#{flag}/#{language}"), class: 'active'))
    else
      html.concat(content_tag(:li, content_tag(:a, '简体中文', href: "/cpanel/introduces/show/#{flag}/1")))
    end

    if language == '2'
      html.concat(content_tag(:li, content_tag(:a, '英文', href: "/cpanel/introduces/show/#{flag}/#{language}"), class: 'active'))
    else
      html.concat(content_tag(:li, content_tag(:a, '英文', href: "/cpanel/introduces/show/#{flag}/2")))
    end

    if language == '3'
      html.concat(content_tag(:li, content_tag(:a, '繁体中文', href: "/cpanel/introduces/show/#{flag}/#{language}"), class: 'active'))
    else
      html.concat(content_tag(:li, content_tag(:a, '繁体中文', href: "/cpanel/introduces/show/#{flag}/3")))
    end

    raw html
  end

  def breadcrumb_cpanel(flag='', language=1)
    hash_nav =  {'description'=> '公司简介',
                 'service'=> '服务介绍',
                 'customer'=> '客户案例',
                 'partner'=> '合作伙伴'}

    title = ''
    hash_nav.each do |k,v|
      title = v if k == flag
    end

    html = <<EOF
<ol class="breadcrumb">
  <li>系统设置</li>
  <li>#{title}</li>
  <li>#{language_for(language)}</li>
</ol>
EOF
    raw html
  end

end
